from typing import Optional, List


class Solution:
    def isValid(self, s: str) -> bool:
        mapp = {
            '(': ')',
            '{': '}',
            '[': ']'
        }
        stack = []
        for i in s:
            if i in mapp:
                stack.append(mapp[i])
            elif not stack or i != stack.pop():
                return False
        return False if stack else True
